package com.eagledata.project.business.purchaseInfo.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.eagledata.common.utils.StringUtil;
import com.eagledata.project.business.purchaseInfo.mapper.PurchaseInfoMapper;
import com.eagledata.project.business.purchaseInfo.domain.PurchaseInfo;
import com.eagledata.project.business.purchaseInfo.service.IPurchaseInfoService;

/**
 * 置业 服务层实现
 * 
 * @author eagledata
 * @date 2018-06-29
 */
@Service
public class PurchaseInfoServiceImpl implements IPurchaseInfoService 
{
	@Autowired
	private PurchaseInfoMapper purchaseInfoMapper;
	
	/**
     * 查询置业信息
     * 
     * @param id 置业ID
     * @return 置业信息
     */
	 @Override
	public PurchaseInfo selectPurchaseInfoById(Integer id) {
	    return purchaseInfoMapper.selectPurchaseInfoById(id);
	}
	
	/**
     * 查询置业列表
     * 
     * @param purchaseInfo 置业信息
     * @return 置业集合
     */
	 @Override
	public List<PurchaseInfo> selectPurchaseInfoList(PurchaseInfo purchaseInfo) {
	    return purchaseInfoMapper.selectPurchaseInfoList(purchaseInfo);
	}
	
    /**
     * 新增置业
     * 
     * @param purchaseInfo 置业信息
     * @return 结果
     */
	 @Override
	public int insertPurchaseInfo(PurchaseInfo purchaseInfo) {
	    return purchaseInfoMapper.insertPurchaseInfo(purchaseInfo);
	}
	
	/**
     * 修改置业
     * 
     * @param purchaseInfo 置业信息
     * @return 结果
     */
	 @Override
	public int updatePurchaseInfo(PurchaseInfo purchaseInfo) {
	    return purchaseInfoMapper.updatePurchaseInfo(purchaseInfo);
	}
	
	/**
     * 保存置业
     * 
     * @param purchaseInfo 置业信息
     * @return 结果
     */
	 @Override
	public int savePurchaseInfo(PurchaseInfo purchaseInfo) {
	    Integer id = purchaseInfo.getId();
		int rows = 0;
		if (StringUtil.isNotNull(id)) {
		    rows = purchaseInfoMapper.updatePurchaseInfo(purchaseInfo);
		} else {
		    rows = purchaseInfoMapper.insertPurchaseInfo(purchaseInfo);
		}
		return rows;
	}
	
	/**
     * 删除置业信息
     * 
     * @param id 置业ID
     * @return 结果
     */
	 @Override
	public int deletePurchaseInfoById(Integer id) {
	    return purchaseInfoMapper.deletePurchaseInfoById(id);
	}
	
	/**
     * 批量删除置业对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	 @Override
	public int batchDeletePurchaseInfo(Integer[] ids) {
		return purchaseInfoMapper.batchDeletePurchaseInfo(ids);
	}
	
}
